<template>
  <!-- 回退dialog-->
  <el-dialog title="回退"
             :visible.sync="isBackOffList.isBackOff"
             :before-close="resetFun"
             class="dialog-class1">
    <el-input type="textarea"
              v-model="desc"
              placeholder="请输入回退原因..."
              rows="10"></el-input>
    <div slot="footer"
         class="dialog-footer">
      <el-button @click="submitFun"
                 style="background: #FF6A6C;color: #FFFFFF;">提 交</el-button>
      <el-button @click="resetFun"
                 style="background: #FFFFFF;">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { rollBack } from '@/api/modules/eventManagement/eventCheck';

export default {
  name: 'backOffDialog',
  data() {
    return {
      desc: '',
    };
  },
  props: {
    isBackOffList: {
      type: Object,
      default: {},
    },
  },
  methods: {
    //提交
    submitFun() {
      let _this = this;
      if (_this.desc == '') {
        this.$message.warning('请填写回退原因!');
        return;
      }
      let params = {
        orderId: _this.isBackOffList.orderId,
        // "warningOrderId": _this.isBackOffList.warningOrderId,
        currentOrderStatus: _this.isBackOffList.currentOrderStatus, //4-处置；5-核实
        backType: _this.isBackOffList.backType, //0-回退到调度 1-回退到处置
        reason: _this.desc,
      };
      rollBack(params, (resp) => {
        if (resp && resp.code == 200) {
          this.$message.success('回退成功');
          this.$router.push({ path: '/event' });
        } else {
          this.$message.warning(resp.mess);
        }
      });

      _this.$emit('backOffCancelFun', false);
    },
    resetFun() {
      this.desc = '';
      this.$emit('backOffCancelFun', false);
    },
  },
};
</script>

<style lang="scss" scoped>
/deep/ .el-dialog__body {
  text-align: center;
}

/deep/ .el-dialog {
  background: #ffffff;
  border-radius: 15px;
}

/deep/ .el-dialog__header {
  background: white;
  border-radius: 15px;
  display: inline-block;
}

.dialog-class1 span {
  width: 240px;
  height: 22px;
  /*font-size: 16px;*/
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  /*color: #333333;*/
  line-height: 22px;
}

/deep/ .el-textarea {
  margin-top: 16px;
}

/deep/ .el-button {
  min-width: 102px;
  height: 40px;
  border-radius: 20px;
}

/deep/ .el-dialog__headerbtn .el-dialog__close {
  color: #aaaaaa;
  /* width: 24px; */
  /* height: 24px; */
  background: #000000;
  border-radius: 15px;
}

/deep/ .el-dialog__header .el-dialog__title:before {
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
  top: 10px;
  left: 10px;
}

/deep/ .el-dialog__header .el-dialog__title {
  width: calc(100% + 30px);
  height: 30px;
  background: #ff6a6c;
  border-radius: 17px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/deep/ .dialog-class4 .el-dialog__header .el-dialog__title {
  display: none;
}

/deep/ .el-input__inner {
  font-size: 14px;
}

/deep/ .el-textarea__inner {
  font-size: 14px;
}
</style>
